# -*- coding: UTF-8 -*-

file1="../transfer_bd.txt";
file2="../transfer_sc.txt";
# resultf="transfer_result.txt";

# srcfile="src.txt";
# file1="transfer_bd.txt";
# file3="entry_bd.txt";
# file4="entry_sc.txt";
resultf="../result.txt";
# data1="";
# data2="";
def compareText(file1,file2):
    with open(file1,'r') as f1:
        data1=f1.read()

    with open(file2,'r') as f2:
        data2=f2.read()

    arr1=set(data1.split(','))
    arr2=set(data2.split(','))

    result1=arr1.difference(arr2)
    result1='\n'.join(result1)
    result2=arr2.difference(arr1)
    result2='\n'.join(result2)
    result1=file1+" >> "+file2+":\n"+result1.__str__()
    result2 =file2+" >> "+file1+":\n"+ result2.__str__()

    print(result1)
    print(result2)

    return result1.__str__()+"\n"+result2.__str__()



result1=compareText(file1,file2)
# result2=compareText(file3,file4)

with open(resultf, 'w') as f:
    f.writelines(result1.__str__()+"\n")


